from django.contrib import admin
from .models import *


# Register your models here.

class UserAdmin(admin.ModelAdmin):
    list_display = ['nickname', 'openid', 'avatar', 'introduct', 'type']
    search_fields = ['nickname', 'openid', 'avatar', 'introduct', 'type']
    list_filter = ['nickname', 'openid', 'avatar', 'introduct', 'type']


admin.site.register(UserModel, UserAdmin)


class PostAdmin(admin.ModelAdmin):
    list_display = ['author', 'content', 'pub_time', 'likes']
    list_filter = ['author']
    search_fields = ['author', 'content']


admin.site.register(PostModel, PostAdmin)


class CommentAdmin(admin.ModelAdmin):
    list_display = ['post', 'author', 'content', 'pub_time']
    list_filter = ['post']
    search_fields = ['post', 'author', 'content']


admin.site.register(CommentModel, CommentAdmin)


# 轮播图
class BannerAdmin(admin.ModelAdmin):
    list_display = ['title', 'picture', 'content']
    search_fields = ['title']


admin.site.register(BannerModel, BannerAdmin)


# 商品
class ShopAdmin(admin.ModelAdmin):
    list_display = ['name', 'content', 'price', 'status', 'author', 'time']
    search_fields = ['name', 'content', 'price', 'author', 'time']
    list_filter = ['name', 'price', 'author', 'time']


admin.site.register(ShopModel, ShopAdmin)


# 订单
class OrderAdmin(admin.ModelAdmin):
    list_display = ['shop', 'author', 'price', 'time', 'status']
    search_fields = ['shop', 'author', 'price']


admin.site.register(OrderModel, OrderAdmin)


# 商家信息
class ShopInfoAdmin(admin.ModelAdmin):
    list_display = ['name', 'content', 'picture', 'position']


admin.site.register(ShopInfoModel, ShopInfoAdmin)


# 圈子
class CircleAdmin(admin.ModelAdmin):
    list_display = ['name', 'author', 'content', 'time', 'number']
    list_filter = ['author']
    search_fields = ['author', 'content']


admin.site.register(CircleModel, CircleAdmin)


# 圈子成员
class CircleMemberAdmin(admin.ModelAdmin):
    list_display = ['circle', 'member', 'time']
    list_filter = ['circle']
    search_fields = ['circle', 'member']


admin.site.register(CircleMemberModel, CircleMemberAdmin)


